package cn.lg.soar.flow.biz.mapper;

import cn.lg.soar.flow.api.model.ApprovalTaskDTO;
import cn.lg.soar.flow.api.model.DoneDTO;
import cn.lg.soar.flow.api.model.TodoDTO;
import cn.lg.soar.flow.biz.model.DoneQuery;
import cn.lg.soar.flow.biz.model.InstanceQuery;
import cn.lg.soar.flow.biz.model.InstanceVO;
import cn.lg.soar.flow.biz.model.TodoQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 节点审批人
 * @author luguoxiang
 * @since 2025-08-07
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Mapper
public interface FlowInstanceMapper {

    IPage<InstanceVO> page(IPage<InstanceVO> page, @Param("query") InstanceQuery query);

    IPage<InstanceVO> started(IPage<InstanceVO> page, InstanceQuery query);

    /**
     * 代办任务
     * @param page
     * @param approvers
     * @param query
     * @return
     */
    IPage<TodoDTO> todo(
            IPage<TodoDTO> page,
            @Param("approvers") List<String> approvers,
            @Param("query") TodoQuery query
    );

    IPage<DoneDTO> done(
            IPage<DoneDTO> page,
            @Param("approval") String approval,
            @Param("query") DoneQuery query
    );

    /**
     * 审批任务
     * @param procInstId 实例id
     * @param approvers 审批人
     * @param taskKey 节点key(非必填)
     * @return
     */
    List<ApprovalTaskDTO> approvalTasks(
            @Param("procInstId") String procInstId,
            @Param("approvers") List<String> approvers,
            @Param("taskKey") String taskKey
    );


}
